<?php
$url = "url=./home.php";
if (isset($_REQUEST["url"]) and $_REQUEST["url"] != "") {
	$url = "url=" . $_REQUEST["url"];
	if (isset($_REQUEST["calc"]) and $_REQUEST["calc"] != "") {
		$url = $url . "&calc=" . $_REQUEST["calc"];
	}
	if (isset($_REQUEST["subCalc"]) and $_REQUEST["subCalc"] != "") {
		$url = $url . "&subCalc=" . $_REQUEST["subCalc"];
		$url = $url . "&calcType=" . $_REQUEST["calcType"];
	}
	if (isset($_REQUEST["artifactType"]) and $_REQUEST["artifactType"] != "") {
		$url = $url . "&pageNo=1&artifactType=" . strtoupper(substr($_REQUEST["artifactType"],0,1));
?>
<script type="text/javascript">
		highlightCurrentMenu(getMenu('<?php echo strtoupper(substr($_REQUEST["artifactType"],0,1))?>'));
</script>
<?php
	}
} else if (isset($_REQUEST["artifactId"]) and $_REQUEST["artifactId"] != "") {
	
	$result = $dbManager->processQuery("SELECT title, url, artifact_type FROM artifacts WHERE artifact_id=" . $_REQUEST["artifactId"],$conn);
	$lw->debug("got artifact from db");
	$row = mysql_fetch_row($result);
	$lw->debug("fetched row");
	$url = "url=./util/artifact_template.php&pg=" . $row[1] . "&artifactType=" . $row[2] . "&artifactId=" . $_REQUEST["artifactId"] . "&artifactTitle=" . $row[0] . "&pageNo=1";
	$lw->debug($url); 
?>
<script type="text/javascript">
		highlightCurrentMenu(getMenu('<?php echo strtoupper(substr($_REQUEST["artifactType"],0,1))?>'));
</script>
<?php
}
if (isset($_REQUEST["menuid"]) and $_REQUEST["menuid"] != "") {
?>
<script type="text/javascript">
		highlightCurrentMenu('<?php echo $_REQUEST["menuid"]?>');
</script>
<?php
}
?>
<iframe frameborder="0" allowtransparency="true" border="0" id="content_frame" name="content_frame" src="<?php echo $config_file['web_root']?>/php/content_template.php?<?php echo $url?>"></iframe>